
$(document).ready(function() {


// this controls the dymanic pricing from the product_info.php
  function priceFromText(text) {
    var re = /.*\$/g;
    return re.test(text) ? parseFloat(text.replace(re, ""), 10) : 0;
  };
  var newPrice = priceFromText($("#productInfoPage h1 span").text());
  $("#dropDowns").on("change", "select", function() {
    var total = 0;
    $("#dropDowns select option:selected").each(function() {
      var ourValue = $(this).text();
      var basePrice = priceFromText(ourValue);
      total += basePrice;
    });
    var theFinalPrice = (newPrice+total);
    theFinalPrice = theFinalPrice.toFixed(2);
    $("#productInfoPage h1 span").text('$'+theFinalPrice);
  });


});

